<template>
    <div>
        123123
    </div>
</template>

<script setup>
import axios from "axios"
// 实例化axios对象
const requests = axios.create({
    baseURL: 'http://127.0.0.1:5000/zijie/',
    timeout: 1000,
})
// 对象形式发起请示
requests({
    method: "get",
    url: "testcase/list",
})
    .then((result) => {
        console.log('rusult', result.data.data);
        ElMessage({
        message: result.data.message,
        type: 'success',
    })
    }).catch((err) => {
        console.log("err", err);

    });


// 别名形式发起请示
requests.get("testcase/list").then((result) => {
    console.log('rusult', result.data.data);
}).catch((err) => {
    console.log("err", err);

});



// 新增
requests.post("testcase/add",{
    "name": "发送post请求",
    "url": "https://httpbin.ceshiren.com/post",
    "method": "POST",
    "params": "{\"id\": 3}",
    "data": "{\"id\": 3}"
}).then((result) => {
    console.log('rusult', result.data.data);
}).catch((err) => {
    console.log("err", err);

});




</script>

<style lang="scss" scoped></style>